package com.time.client.common.enums;

import lombok.Getter;

/**
 * 文章状态枚举类
 *
 * @author: HuangQi
 * @date: Created in 10:43 2025/10/9
 * @description: 文章状态枚举
 */
@Getter
public enum PostStatusEnum {

    DRAFT(0, "草稿"),
    REVIEWING(1, "审核中"),
    REVIEW_FAILED(2, "审核失败"),
    REVIEW_PASSED(3, "审核成功"),
    PUBLISHED(4, "已发布");

    public int code;

    public String desc;

    PostStatusEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static PostStatusEnum getByCode(int codeVal) {
        for (PostStatusEnum postStatusEnum : PostStatusEnum.values()) {
            if (postStatusEnum.code == codeVal) {
                return postStatusEnum;
            }
        }
        return null;
    }
}
